<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/text', 'TestController@index');

Route::post('/token',  'TokenController@index');
Route::get('/',  'HomeController@index');

Route::get('/area/{id}', 'AreaController@index');
Route::post('/area/word', 'AreaController@getWrod');

Route::get('/scene/{id?}', 'SceneController@index');
Route::get('/auth/regist', function () {
    return view('pages.regist');
});
Route::post('/auth/regist','Auth\LoginController@regist');

Route::group(['prefix' => 'auth'], function () {
    Route::get('/login', 'Auth\LoginController@logIn');
    Route::post('/login', 'Auth\LoginController@postLogIn');
    //退出登录
    Route::post('/logout', 'Auth\LoginController@logout');
});

Route::group(['prefix' => 'admin', 'middleware'=>['admin']], function () {
    Route::get('/home', 'Admin\HomeController@index');
    Route::get('/user/list/{search?}', 'Admin\UserController@userList');
    Route::get('/user/{type}/{id?}', 'Admin\UserController@userHandler');
    Route::post('/user/save', 'Admin\UserController@saveUser');
    Route::post('/user/delete', 'Admin\UserController@deleteUser');

    Route::get('/activity/list/{search?}', 'Admin\ActivityController@activityList');
    Route::get('/activity/{type}/{id?}', 'Admin\ActivityController@activityHandler');
    Route::post('/activity/save', 'Admin\ActivityController@saveActivity');
    Route::post('/activity/delete', 'Admin\ActivityController@deleteActivity');

    Route::get('/area/list/{search?}', 'Admin\AreaController@areaList');
    Route::get('/area/{type}/{id?}', 'Admin\AreaController@areaHandler');
    Route::post('/area/save', 'Admin\AreaController@saveArea');
    Route::post('/area/delete', 'Admin\AreaController@deleteArea');

    Route::get('/scene/list/{search?}', 'Admin\SceneController@sceneList');
    Route::get('/scene/{type}/{id?}', 'Admin\SceneController@sceneHandler');
    Route::post('/scene/save', 'Admin\SceneController@saveScene');
    Route::post('/scene/delete', 'Admin\SceneController@deleteScene');
});

Route::group(['prefix' => 'admin'], function () {
    Route::get('/login', 'Admin\AuthController@logIn');
    Route::post('/login', 'Admin\AuthController@postLoginIn');
});

Route::get('/admin/test',  'HomeController@test');
Route::post('/image/upload', 'ImageController@upload');


Route::post('/sidebar/scene/list', 'SceneController@getSideList');

Route::post('/search/area', 'AreaController@getSearchData');

Route::post('/scene/list', 'AreaController@getSceneList');
